package de.tewdreyer.android.erc;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

public class ShowInfo extends Activity {
	
	private static WebView showInfoView;
	
	/**
     * create visual objects (webview)
     * @param inState activity's previous state 
     * @see android.app.Activity#onCreate(android.os.Bundle)
     */
	@Override
	public void onCreate(Bundle inState) {
        super.onCreate(inState);

        setContentView(R.layout.show_info);

        showInfoView = (WebView)findViewById(R.id.webview);
        ShowInfo.reload();
    }

    /**
     * save activity's state
     * @param outState activity's current state
     */
	@Override
    public void onSaveInstanceState(Bundle outState){
        showInfoView.saveState(outState);

        super.onSaveInstanceState(outState);
    }

	/**
	 * restore activity's state
	 * @param inState activity's previous state
	 */
    @Override
    public void onRestoreInstanceState(Bundle inState){
        super.onRestoreInstanceState(inState);

        if(showInfoView != null){
            showInfoView.restoreState(inState);
        }
    }

    /** 
     * reload the webview
     */
    public static void reload() {
        if(ERC.deviceIdentifier != null)
        	showInfoView.loadUrl(ERC.showInfoUrl + ERC.deviceIdentifier + "?" + ERC.urlParamShowPlain);
    }
}